<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/6/25
  Time: 15:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="common.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>AAA心理测试后台管理</title>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">AAA测试后台管理</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="${userInfo.avatar}" class="layui-nav-img">
                    ${userInfo.username}
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="${pageContext.request.contextPath}/views/updateUser.jsp">个人信息</a></dd>
                    <dd><a href="${pageContext.request.contextPath}/logout.do">注销</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-shrink="all" lay-filter="test">
                <c:forEach items="${menuMap.menuListlevel1}" var="menuLevel1">
                <li class="layui-nav-item">
                    <a class="" href="javascript:;"><i class="${menuLevel1.icon}"></i>&nbsp<span>${menuLevel1.menuName}</span></a>
                    <c:forEach items="${menuMap.menuListlevel2}" var="menuLevel2">
                    <%--  判断自己的父亲id是否跟一级菜单的id一致--%>
                        <c:if test="${menuLevel2.parentId eq menuLevel1.menuId}">
                            <dl class="layui-nav-child">
                                <dd><a href="${pageContext.request.contextPath}${menuLevel2.url}" >${menuLevel2.menuName}</a></dd>
                            </dl>
                        </c:if>
                    </c:forEach>
                </li>
                </c:forEach>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <iframe id="iframMain" width="100%" height="100%" src="hello.jsp"></iframe>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        底部固定区域
    </div>
</div>

<script>
    //JavaScript代码区域
    layui.use(['element', 'jquery'], function () {
        var element = layui.element;
        var $ = layui.jquery;
        $(function () {
            //页面加载之后执行的代码
            //点击a标签的时候，修改iframe的src属性
            $("dd>a").click(function (e) {
                //阻断超链接的跳转事件
                e.preventDefault();
                //取得超链接对象的href属性值赋给iframe的src属性
                $("#iframMain").attr("src", $(this).attr("href"));
            })
        })
    });
</script>
</body>
</html>
